/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package View;

import Utilities.TrainingUtilities;
import com.sun.lwuit.Button;
import com.sun.lwuit.Command;
import com.sun.lwuit.Component;
import com.sun.lwuit.Display;
import com.sun.lwuit.Label;
import com.sun.lwuit.events.ActionEvent;
import com.sun.lwuit.events.ActionListener;
import com.sun.lwuit.geom.Dimension;
import com.sun.lwuit.layouts.BoxLayout;
import com.sun.lwuit.plaf.Border;
import com.sun.lwuit.plaf.Style;
import com.sun.lwuit.plaf.UIManager;
import testmenu.MainMidlet;

/**
 *
 * @author Huy
 */
public class TrainingForm extends View {

    private Label lbl_Title;
    private Command cmd_Back;
    private final Button btn_submitac;

    public TrainingForm(final MainMidlet midlet) {
        super(midlet);

        this.lbl_Title = new Label("Hôm nay bạn nên làm gì ?");

        addComponent(lbl_Title);
        TrainingUtilities u = new TrainingUtilities();
        String[] sg = u.getActivities(midlet.getActivity_mode(), midlet.getVar_BMR(), 250);
        for (int i = 0; i < sg.length; i++) {
            Label txt = new Label(" - " + sg[i]);
//            txt.setEditable(false);
            txt.setSize(new Dimension(200, 100));
            txt.startTicker(UIManager.getInstance().getLookAndFeel().getTickerSpeed(), true);
            addComponent(txt);
            System.out.println(sg[i]);
        }

        btn_submitac = new Button("Hôm nay tôi đã...");
        btn_submitac.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent ae) {
                midlet.showTrainedForm();
            }
        });
        addComponent(btn_submitac);

        cmd_Back = new Command("") {
            public void actionPerformed(ActionEvent evt) {

                Display.getInstance().setForceFullScreen(true);
                midlet.getmmf().showBack();
            }
        };
        setBackCommand(cmd_Back);
    }
}
